import { _decorator, Sprite } from 'cc'
import { ZController } from '../../Zcc'
import { DiceNum } from '../../types/GameEnums'
const { ccclass } = _decorator

@ccclass('DiceController')
export class DiceController extends ZController {
	private _dice: DiceNum = DiceNum.ONE

	// 设置骰子点数
	public setDice(dice: DiceNum) {
		this._dice = dice
		let sprite = this.node.getComponent(Sprite)
		this.node.getComponent(Sprite).spriteFrame = sprite.spriteAtlas.getSpriteFrame(dice.toString())
	}

	// 获取当前骰子点数
	public getDice(): DiceNum {
		return this._dice
	}
}
